package com.softwinner.bt.util;

import android.os.Gpio;
import android.util.Log;

public class GpioHelper {
    public static final int BT_OPEN = 1;
    public static final int BT_CLOSE = 0;
    
    public static int readBtStatus() {
        return Gpio.readGpio('A', 1);
    }

    public static void openBtPower() {
    	Gpio.writeGpio('A', 1, 1);
    	int s = readBtStatus();
    	Log.e("test", "-->"+s);
    }

    public static void closeBtPower() {
    	Gpio.writeGpio('A', 1, 0);
    	int s = readBtStatus();
    	Log.e("test", "---->"+s);
    }
    
    public static boolean IsSpkOpen(){
    	boolean spkopen = Gpio.readGpio('H', 15)==1;
    	BTLog.e(GpioHelper.class, "speak open = " + spkopen);
    	return spkopen;
    }
    public static void closeSPK(){
    	Gpio.writeGpio('H', 15, 0);
    	BTLog.e(GpioHelper.class, "close speak,open = " + IsSpkOpen());
    }
    public static void openSPK(){
    	Gpio.writeGpio('H', 15, 1);
    	BTLog.e(GpioHelper.class, "open speak,open = " + IsSpkOpen());
    }
}
